package com.spzx.product.api.service;


import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import com.spzx.product.api.domain.vo.CategoryVo;
import com.spzx.product.api.factory.RemoteCategoryFallbackFactory;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.List;

/*
*
* 远程调用商品微服务
* fallbac属性: 用来配置当前远程调用失败时调用的降级方法的类型
* */
@FeignClient(contextId = "RemoteCategoryService",value = ServiceNameConstants.PRODUCT_SERVICE,fallbackFactory=RemoteCategoryFallbackFactory.class)
public interface RemoteCategoryService {

    @GetMapping(value = "/category/getFirstLeveCategory/{parentId}")
    public R<List<CategoryVo>> getFirstLeveCategory(@PathVariable( value = "parentId",required = false) Long parentId,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @Operation(summary = "微服务内部远程调用获取分类嵌套列表的接口")
    @GetMapping(value = "/category/getCategorytreeList")
    public R<List<CategoryVo> > getCategoryTreeList(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);



}
